#include "board.h"
#include "bflb_mtimer.h"
#include "bflb_gpio.h"
#include "bflb_joystick.h"


int main(void)
{
    board_init();
    bflb_joystick_init(GPIO_PIN_19, GPIO_PIN_10, GPIO_PIN_13);

    struct bflb_joystick_attr myJoystick;  
    
    while (1)
    {
        // 调用函数读取摇杆数据  
        bflb_joystick_read(&myJoystick, GPIO_PIN_13);  

        // 显示读取的数据  
        printf(">X轴通道:%d  X轴位置:%d  X轴电压:%d\r\n", myJoystick.result_x.pos_chan,myJoystick.result_x.value,myJoystick.result_x.millivolt);  
        printf(">Y轴通道:%d  Y轴位置:%d  Y轴电压:%d\r\n", myJoystick.result_y.pos_chan,myJoystick.result_y.value,myJoystick.result_y.millivolt);  
        printf(">开关状态：%d\r\n", myJoystick.result_sw);
        bflb_mtimer_delay_ms(500);
    }
}
